using System;
using System.Collections.Generic;
using System.Text;
using FlatRedBall;
using FlatRedBall.Graphics;
using FlatRedBall.ManagedSpriteGroups;
using FlatRedBall.Math;
using FlatRedBall.Math.Geometry;
using FlatRedBall.AI.Pathfinding;
using FlatRedBall.Graphics.Animation;
using FlatRedBall.Input;
using FlatRedBall.Graphics.Particle;
using FlatRedBall.Instructions;
using FlatRedBall.Math.Splines;
using BitmapFont = FlatRedBall.Graphics.BitmapFont;

using Cursor = FlatRedBall.Gui.Cursor;
using GuiManager = FlatRedBall.Gui.GuiManager;

#if FRB_XNA || SILVERLIGHT
using Keys = Microsoft.Xna.Framework.Input.Keys;
using Vector3 = Microsoft.Xna.Framework.Vector3;
using Texture2D = Microsoft.Xna.Framework.Graphics.Texture2D;
using Microsoft.Xna.Framework.Media;
#endif

// Generated Usings
using FlatRedBall.Broadcasting;
using Gnome.Entities;
using FlatRedBall;

namespace Gnome.Screens
{
	public partial class LevelOneMult : LevelBaseMult
	{
        

        protected static double mAccumulatedPausedTime = 0;

        public static double PauseAdjustedCurrentTime
        {
            get { return TimeManager.CurrentTime - mAccumulatedPausedTime; }
        }

		// Generated Fields
		private Scene level3;


		public LevelOneMult()
			: base()
		{
            mAccumulatedPausedTime = 0;
		}

        public override void Initialize(bool addToManagers)
        {
			// Generated Initialize
			level3 = FlatRedBallServices.Load<Scene>("content/screens/levelone/level3.scnx", ContentManagerName);
			LoadStaticContent(ContentManagerName);



			base.Initialize(addToManagers);

        }

// Generated AddToManagers

        public override void AddToManagers()
        {

            base.AddToManagers();
			CustomInitialize();

        }


		public override void Activity(bool firstTimeCalled)
		{
			// Generated Activity
			if(!IsPaused)
			{
				level3.ManageAll();
			}
			else
			{
			}

            if (IsPaused)
            {
                mAccumulatedPausedTime += TimeManager.SecondDifference;
            }

			base.Activity(firstTimeCalled);

            if (!IsActivityFinished)
            {
                CustomActivity(firstTimeCalled);
            }
		}

		public override void Destroy()
		{
			// Generated Destroy
			level3.RemoveFromManagers();



			base.Destroy();

			CustomDestroy();

            if (IsPaused)
            {
                UnpauseThisScreen();
            }
		}

        protected override void PauseThisScreen()
        {
			base.PauseThisScreen();
		
            
            

        }

        void UnpauseThisScreen()
        {
            InstructionManager.UnpauseEngine();
            this.IsPaused = false;
        }

        public static double PauseAdjustedSecondsSince(double time)
        {
            return PauseAdjustedCurrentTime - time;
        }

		// Generated Methods
		public override void PostInitialize()
		{
			base.PostInitialize();
			MaxItems = 10;
			ShadowCount = 5;
			MapName = "";
			MaxPowerups = 1;
		}
		public override void AddToManagersBottomUp()
		{
			base.AddToManagersBottomUp();
			level3.AddToManagers(mLayer);

		}
		public override void ConvertToManuallyUpdated()
		{
			base.ConvertToManuallyUpdated();
			level3.ConvertToManuallyUpdated();
		}
		public static void LoadStaticContent(string contentManagerName)
		{
			bool registerUnload = false;
			GnomePlayer.LoadStaticContent(contentManagerName);
			HomeBase.LoadStaticContent(contentManagerName);
			Bird.LoadStaticContent(contentManagerName);
			GnomePlayer.LoadStaticContent(contentManagerName);
			HomeBase.LoadStaticContent(contentManagerName);
			const bool throwExceptionIfAfterInitialize = false;
			if(throwExceptionIfAfterInitialize && registerUnload && ScreenManager.CurrentScreen != null && ScreenManager.CurrentScreen.ActivityCallCount > 0 && !ScreenManager.CurrentScreen.IsActivityFinished)
			{
				throw new InvalidOperationException("Content is being loaded after the current Screen is initialized.  This exception is being thrown because of a setting in Glue.");
			}
			CustomLoadStaticContent(contentManagerName);
		}


	}
}
